package com.elf.bluetoothtest.widget;

import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;

import com.elf.bluetoothtest.databinding.ListItemBluetoothBinding;

public class BluetoothListItemWidget extends AbsFrameLayout {

    ListItemBluetoothBinding binding;

    public BluetoothListItemWidget(Context context) {
        super(context);
    }

    public BluetoothListItemWidget(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void initView(AttributeSet attrs) {
        binding = ListItemBluetoothBinding.inflate(LayoutInflater.from(getContext()), this, true);
    }

    public void setData(BluetoothDevice device,short rssi) {
        binding.tvTitle.setText(device.getName());
        binding.tvMac.setText(device.getAddress());
        binding.tvSignal.setText(String.valueOf(rssi));
    }
}
